import minRequest from '@/utils/request'

// 查询参数列表
export function listConfig(query) {
  return minRequest.get('/system/config/list', query)
}

// 获取sku列表
export function skuList(params) {
  return minRequest.get(`/system_setting/sku/list`, params)
}

// 检查是否存在正在执行中的盘点计划
export function getImsInventoryPlan(params) {
  return minRequest.get(`/ims/inventoryPlan/getImsInventoryPlan`, params)
}

// 校验所选产品是否能一起入库
export function existAreaOfSkuIds(params) {
  return minRequest.post(`/ims_data/sku/existAreaOfSkuIds`, params)
}

// 校验托盘码
export function checkPalletCode(params) {
  return minRequest.post(`/ims/palletCodeSku/checkPalletCode`, params)
}

// 获取历史入库单详情
export function InWorkHistoryDetail(id) {
  return minRequest.get(`/workOrder/workOrder/history/${id}`)
}

// 获取入库信息
export function imsStockInWorkHistoryList(params) {
  return minRequest.get(`/ims_data/imsStockInWorkHistory/list`, params)
}

// 获取当前是否有托盘码
export function getCurrentPalletCode(params) {
  return minRequest.get(`/ims_data/imsStockInWork/getCurrentPalletCode`, params)
}

// 校验产品码是否已经存在
export function checkSkuBarcode(params) {
  return minRequest.post(`/ims/palletCodeSku/checkSkuBarcode`, params, {
    noFormHasValue: true,
  })
}

// 校验托盘码是否使用
export function palletCodeSkuList(params) {
  return minRequest.get(`/ims/palletCodeSku/list`, params)
}

// 站点
export function stationList(params) {
  return minRequest.get(`/system_setting/imsAreaStation/listOfIdle`, params)
}

// 码头
export function wharfList(params) {
  return minRequest.get(`/system_setting/wharf/list`, params)
}

// 根据托盘码查询入库单
export function imsStockInWorkList(params) {
  return minRequest.get(`/ims_data/imsStockInWork/list`, params)
}

// 监测站
export function imsDetectionStation(params) {
  return minRequest.get(`/system_setting/imsDetectionStation/list`, params)
}

// 确认入库
export function imsStockInWork(params) {
  return minRequest.post(`/ims_data/imsStockInWork/addOrUpdateInWork`, params)
}

// 扫码完成
export function palletCodeSku(params) {
  return minRequest.post(`/ims/palletCodeSku`, params)
}

// 生成条码
export function generateBarcode(id) {
  return minRequest.get(`/ims_data/barcodeRecord/generateBarcode/${id}`)
}

// 打印条码
export function autoPrint(id) {
  return minRequest.get(`/ims_data/barcodeRecord/autoPrint/${id}`)
}

// 补打印条码
export function manualPrint(barCode) {
  return minRequest.get(`/ims_data/barcodeRecord/manualPrint/${barCode}`)
}

// 查询详情
export function barcodeRecordList(params) {
  return minRequest.get('/ims_data/barcodeRecord/list', params)
}

// 修改入库单管理
export function updateWorkOrder(data) {
  return minRequest.put('/workOrder/workOrder', data)
}

// 修改入库单管理状态
export function updateWorkOrderStatus(params) {
  return minRequest.put('/workOrder/workOrder/status', params)
}

// 删除入库单管理
export function delWorkOrder(inOrderId) {
  return minRequest.delete('/workOrder/workOrder/' + inOrderId)
}

// 查询入库单管理详细
export function getWorkOrder(inOrderId) {
  return minRequest.get('/workOrder/workOrder/' + inOrderId)
}

// 查询是否需要双取
export function isNeedEvenNumberSku() {
  return minRequest.get('/system_setting/ims/config/isNeedEvenNumber')
}

// 新增入库单管理
export function addWorkOrder(params) {
  return minRequest.post('/workOrder/workOrder', params)
}

// 查询仓库管理详细
export async function getIms(imsId) {
  return minRequest.get('/system_setting/ims/' + imsId)
}

// 查询仓库sku详细
export async function getSku(skuId) {
  return minRequest.get('/system_setting/sku/' + skuId)
}

// 查询租户列表
export async function listTenant(params) {
  return minRequest.get('/system_setting/tenant/list', params)
}

// 查询历史入库单列表
export async function inWorkHistory(data) {
  return minRequest.get('/workOrder/workOrder/list/history', data)
}

// 根据样件图号查询SKU信息
export async function packingQuantity(partNo) {
  return minRequest.get(`/ims_pda/stock_in_order/packing-quantity/${partNo}`)
}

// 新增入库单
export async function AddStockInOrder(params) {
  return minRequest.post(`/ims_pda/stock_in_order`, params)
}

// 修改入库单
export async function UpdateStockInOrder(params) {
  return minRequest.put(`/ims_pda/stock_in_order`, params)
}
